//
//  indexTableViewCell.m
//  Weibo
//
//  Created by wpapple on 16/6/2.
//  Copyright © 2016年 红红火火恍恍惚惚嘿嘿嘿. All rights reserved.
//

#import "indexTableViewCell.h"

@interface indexTableViewCell()

@property (weak, nonatomic) IBOutlet UIImageView *icon;
@property (weak, nonatomic) IBOutlet UILabel *name;
@property (weak, nonatomic) IBOutlet UILabel *comeFrom;
@property (weak, nonatomic) IBOutlet UILabel *contentText;
@property (weak, nonatomic) IBOutlet UIImageView *vip;


@end

@implementation indexTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)setStatus:(IWStatus *)status{
    _status = status;
    
    NSString * comeFrom = [NSString stringWithFormat:@"%@ %@",status.created_at,status.source];
    
    [self.icon sd_setImageWithURL:[NSURL URLWithString:_status.user.profile_image_url] placeholderImage:[UIImage imageNamed:@"avatar_default_big"]];
    self.name.text = status.user.name;
    self.comeFrom.text = comeFrom;
    self.contentText.text = status.text;
    
    if (status.user.isVip) {
        [self.name setTextColor:[UIColor redColor]];
        self.vip.hidden = NO;
        NSString * vipRank = [NSString stringWithFormat:@"common_icon_membership_level%@",status.user.mbrank];
        [self.vip setImage:[UIImage imageNamed:vipRank]];
    }
}


@end
